# encoding: utf-8
# Author    : limusen
# Datetime  : 2023/9/27 09:54
# File      : config.py
# explain   : 文件说明


import os
import configparser

current_directory = os.path.dirname(__file__)
config_path = os.path.join(current_directory, '../config/config.ini')


class ConfigUtils:
    def __init__(self, path=config_path):
        self.config_parser = configparser.ConfigParser()
        self.config_parser.read(path, encoding="utf-8")

    @property
    def host(self):
        return self.config_parser.get("DEFAULT", "HOST")

    @property
    def driver_path(self):
        return self.config_parser.get("DRIVER_PATH", "DRIVER_PATH")

    @property
    def screen_shot_path(self):
        return self.config_parser.get("SCREEN", "SCREEN_PATH")

    @property
    def logs_path(self):
        return self.config_parser.get("LOGS", "LOGS_PATH")

    @property
    def log_level(self):
        return int(self.config_parser.get("LOGS", "LOG_LEVEL"))

    @property
    def default_driver(self):
        return self.config_parser.get("DRIVER", "DEFAULT_DRIVER")

    @property
    def error_file_path(self):
        return self.config_parser.get("ERROR", "ERROR_FILE")

    @property
    def code_path(self):
        return self.config_parser.get("DEFAULT", "CODE_PATH")


local_config = ConfigUtils()

if __name__ == "__main__":
    print(local_config.logs_path)
    print(local_config.code_path)
